# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pydivert
pkgname=('python2-pydivert' 'python-pydivert')
_pkgname=pydivert
pkgver=2.1.0
pkgrel=9
pkgdesc='Python binding to windivert driver.'
arch=('any')
url='https://pypi.python.org/pypi/pydivert/'
license=('LGPL3')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://pypi.python.org/packages/cf/71/2da9bcf742df3ab23f75f10fedca074951dd13a84bda8dea3077f68ae9a6/$_pkgname-$pkgver.tar.gz")
sha512sums=('5d5f5256a7800ea6e383e8c646c9d08f4f6d01de00878530aaa64bd6d45bb7a111ec51d0a58a6f711e4d830c67ee21c6e77d8acc6ed32de131dcc27ddb483d22')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pydivert() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pydivert() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

